import { h } from "vue";
import { render } from "@/utils";
import systemType from "common/systemType.vue";
import TagStatus from "@/components/TagStatus/index.vue";
import LinkText from "@/components/LinkText/index.vue";

export const columns = [
  {
    title: "名称",
    dataIndex: "osName",
    render: ({ record }) =>
      h(LinkText, {
        label: record?.osName,
        max_width:'',
        to: `/model-mgmt/operating-system/detail/${record?.id}?name=${record?.osName}`,
      }),
  },
  {
    title: "系统",
    dataIndex: "system",
    tooltip: true,
    ellipsis: true,
    render: ({ record }) => h(systemType, { type:record?.osType  }),
  },
  {
    title: "是否启用",
    dataIndex: "enabled",
    slotName: "enabled",
  },
  {
    title: "描述",
    dataIndex: "description",
    // width: 90,
    render,
  },
  {
    title: "创建信息",
    dataIndex: "lastTime",
    slotName: "lastTime",
    width: 170,
    render: ({ record }) =>
      h(LinkText, { label: record?.createTime, desc: record?.createBy }),
  },
  {
    title: "变更信息",
    dataIndex: "lastTime",
    slotName: "lastTime",
    width: 170,
    render: ({ record }) =>
      h(LinkText, { label: record?.updateTime, desc: record?.updateBy}),
  },
  {
    title: "操作",
    width: 110,
    dataIndex: "action",
    fixed: "right",
    slotName: "action",
  },
]
export const standardImageColumns = [
  {
    title: "镜像名称",
    dataIndex: "name",
    render
  },
  {
    title: "显示名称",
    dataIndex: "templateAlias",
    tooltip: true,
    ellipsis: true,
    render
  },
  {
    title: "平台",
    dataIndex: "platform",
    render
  },
  {
    title: "创建信息",
    dataIndex: "lastTime",
    slotName: "lastTime",
    width: 170,
    render: ({ record }) =>
      h(LinkText, { label: record?.createTime, desc: record?.createBy }),
  },
  {
    title: "变更信息",
    dataIndex: "lastTime",
    slotName: "lastTime",
    width: 170,
    render: ({ record }) =>
      h(LinkText, { label: record?.updateTime, desc: record?.updateBy}),
  },
  {
    title: "操作",
    width: 80,
    dataIndex: "action",
    fixed: "right",
    slotName: "action",
  },
]
